<template>
  <view class="payment-container">
    <!-- 订单明细 -->
    <view class="order-section">
      <text class="section-title">订单明细</text>
      <view class="order-detail">
        <view class="detail-item">
          <text>青城前山成人票</text>
          <text>¥80</text>
        </view>
        <view class="detail-item">
          <text>购买数量</text>
          <text>1张</text>
        </view>
        <view class="detail-item">
          <text>游玩日期</text>
          <text>2025-05-29</text>
        </view>
        <view class="detail-item total">
          <text>总金额</text>
          <text>¥80</text>
        </view>
      </view>
    </view>

    <!-- 支付方式 -->
    <view class="payment-section">
      <text class="section-title">支付方式</text>
      <view class="payment-method">
        <view class="method-item" @click="selectMethod('wechat')">
          <image
              src="https://logo800.cn/uploads/shiliang/20/logo800_16491862509411925.png"
              class="method-icon"
              mode="widthFix"
          ></image>
          <view class="method-info">
            <text>微信</text>
            <view class="radio" :class="{selected: selectedMethod === 'wechat'}"></view>
          </view>
        </view>
        <view class="method-item" @click="selectMethod('alipay')">
          <image
              src="https://ts1.tc.mm.bing.net/th/id/R-C.9710db5ab36d67b94c491fe9fb1223ab?rik=UHxTNvtYQJKc3Q&riu=http%3a%2f%2fwww.kuaipng.com%2fUploads%2fpic%2fw%2f2024%2f01-20%2f149784%2fwater_149784_698_698_.png&ehk=mh8TMdPyH1Cav3vFhYq39DeAkm9%2bzLDAr1usichN21I%3d&risl=&pid=ImgRaw&r=0"
              class="method-icon"
              mode="widthFix"
          ></image>
          <view class="method-info">
            <text>支付宝</text>
            <view class="radio" :class="{selected: selectedMethod === 'alipay'}"></view>
          </view>
        </view>
      </view>
    </view>

    <!-- 底部支付栏 -->
    <view class="payment-bar">
      <view class="price-info">
        <text>总金额：</text>
        <text class="total-price">￥80</text>
        <text class="quantity">数量1</text>
      </view>
      <view class="confirm-btn" @click="confirmPayment">
        <text>确认支付</text>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      selectedMethod: 'wechat' // 默认选中微信
    };
  },
  methods: {
    selectMethod(method) {
      this.selectedMethod = method;
    },
    confirmPayment() {
      uni.showToast({
        title: '支付成功',
        icon: 'none'
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.payment-container {
  background-color: #f0f8ff; /* 浅绿色背景 */
  min-height: 100vh;
  padding: 20rpx;
}

.section-title {
  font-size: 32rpx;
  font-weight: bold;
  display: block;
  margin-bottom: 20rpx;
}

.order-section, .payment-section {
  background-color: #fff;
  border-radius: 12rpx;
  padding: 30rpx;
  margin-bottom: 20rpx;
}

.order-detail {
  .detail-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20rpx;
    font-size: 28rpx;
    color: #333;

    &.total {
      font-weight: bold;
      border-top: 1rpx solid #eee;
      padding-top: 20rpx;
      margin-top: 20rpx;
    }
  }
}

.payment-method {
  .method-item {
    display: flex;
    align-items: center;
    padding: 25rpx 0;
    border-bottom: 1rpx solid #eee;
    position: relative;


    &:last-child {
      border-bottom: none;
    }

    .method-icon {
      width: 100rpx;
      height: 80rpx;
      margin-right: 20rpx;
    }



    .radio {
      float: right;
      width: 36rpx;
      height: 36rpx;
      border-radius: 50%;
      border: 1rpx solid #ddd;
      position: absolute;
      margin-left: 50px;

      &.selected {
        border-color: #07C160;
        background-color: #07C160;
        position: relative;

        &::after {
          content: '';
          position: absolute;
          width: 20rpx;
          height: 10rpx;
          border-left: 4rpx solid #fff;
          border-bottom: 4rpx solid #fff;
          transform: rotate(-45deg);
          top: 10rpx;
          left: 8rpx;
        }
      }
    }

  }
}

.payment-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20rpx 30rpx;
  box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);

  .price-info {
    display: flex;
    align-items: center;

    .total-price {
      font-size: 36rpx;
      color: #ff4d4f;
      font-weight: bold;
      margin: 0 10rpx;
    }

    .quantity {
      font-size: 24rpx;
      color: #999;
    }
  }

  .confirm-btn {
    background-color: #07C160;
    color: #fff;
    padding: 20rpx 50rpx;
    border-radius: 50rpx;
    font-size: 32rpx;
  }
}
</style>
